﻿using System;
using System.Diagnostics;
using System.Text;

namespace Listing3_52
{
    class Program
    {
        const int NumberOfIterations = 100000;

        static void Main(string[] args)
        {
            //Stopwatch sw = new Stopwatch();
            //sw.Start();
            Algorithm1();
            //sw.Stop();

            //Console.WriteLine(sw.Elapsed);

            //sw.Reset();
            //sw.Start();
            Algorithm2();
            //sw.Stop();

            //Console.WriteLine(sw.Elapsed);
            Console.WriteLine("Ready…");
            Console.ReadLine();
        }

        private static void Algorithm2()
        {
            string result = "";
            for (int x = 0; x < NumberOfIterations; x++)
            {
                result += 'a';
            }
        }

        private static void Algorithm1()
        {
            StringBuilder sb = new StringBuilder();
            for (int x = 0; x < NumberOfIterations; x++)
            {
                sb.Append('a');
            }
            string result = sb.ToString();
        }
    }
}